package com.example.clock;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
public class ChatApplication {

    private static final Logger logger = LoggerFactory.getLogger(ChatApplication.class);


    public static void main(String[] args) throws UnknownHostException {
        Environment env = SpringApplication.run(ChatApplication.class, args).getEnvironment();
        String port = env.getProperty("server.port", "8080");
        String ip = InetAddress.getLocalHost().getHostAddress();
        logger.info(
                "Access URLs:\n----------------------------------------------------------\n\t"
                        + "Local: \t\thttp://127.0.0.1:{}\n\t"
                        + "External: \thttp://{}:{}\n\t"
                        + "app: \t\thttp://127.0.0.1:{}/app/getClockList?userName=xxx\n\t"
                        + "pc: \t\thttp://127.0.0.1:{}/pc/getClockList?userName=xxx\n\t"
                        + "attend: \thttp://127.0.0.1:{}/attend/getClockList?userName=xxx\n\t"
                        + "----------------------------------------------------------",
                port, ip, port, port, port, port);


    }
}
